//var baseUrl="http://192.168.0.119";
var baseUrl="http://localhost";

function window_href(href) {
    window.location.href=href;
}

function   formatDateYMD(now)   {     
    var   year=now.getYear().toString();
    var   month=now.getMonth()+1;
    var   date=now.getDate();
    var   hour=now.getHours();
    var   minute=now.getMinutes();
    var   second=now.getSeconds();
    return   "20"+year.substr(1,year.length)+"-"+month+"-"+date;
}

function formatFullDate(now)   {
    now = new Date(now);
    var year=now.getYear().toString();
    var month=now.getMonth()+1;
    var date=now.getDate();
    var hour=now.getHours();
    var minute=now.getMinutes();
    var second=now.getSeconds();
    if(month<10) {
        month='0'+month;
    }
    if(date<10) {
        date='0'+date;
    }
    if(hour<10) {
        hour='0'+hour;
    }
    if(minute<10) {
        minute='0'+minute;
    }
    if(second<10) {
        second='0'+second;
    }
    return "20"+year.substr(1,year.length)+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
}

function formatBankCardNo(s) {
    s = s + "";
    return s.replace(/(\d{4})(?=\d)/g,"$1"+"-");
}
function changePrice2money(s) {
    s = s + "";
    if (/[^0-9\.]/.test(s)) return "invalid value";
    s = s.replace(/^(\d*)$/, "$1.");
    s = (s + "00").replace(/(\d*\.\d\d)\d*/, "$1");
    s = s.replace(".", ",");
    var re = /(\d)(\d{3},)/;
    while (re.test(s))
        s = s.replace(re, "$1,$2");
    s = s.replace(/,(\d\d)$/, ".$1");
    return s.replace(/^\./, "0.")
}
